#ifndef MAINWINDOW_H
#define MAINWINDOW_H


#define TAB_HEAD 0
#define TAB_TABLE 1
#define FILE_FORMAT "t13"
#define WINDOW_TITLE "T-13"
#define RECENT_SIZE "10"


#include <QMainWindow>
#include <QDate>
#include "diaaddperson.h"
#include "diasettings.h"
#include <QSettings>
#include <QCloseEvent>
#include <QtXml/QtXml>
#include <QStringList>
#include <QVector>


namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    QDate currentPeriod;
    void InitTable();
    bool eventFilter(QObject *, QEvent *);
    QString configPath;
    QSettings * cfg;
    QDomDocument * xmlDoc;
    QString fpath;
    void initXml();

    QString createDocument();

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    
private:
    Ui::MainWindow *ui;
    void closeEvent(QCloseEvent *event);
    void saveFile(QString path);
    void QMBisChanged();
    bool isChanged;
    bool toContinue;
    void writeSettings();
    void readSettings();
    void ChangeRekvizite(QString rekname, QString rekvalue);
    void ReinitMW();
    void ChangeColumnWidth();

    // Recently Files
    void setRecentToCfg(QString filename);
    void createRecent();
    void openFile();
    QAction *clearAct;
    QVector<QAction*> vec;


private slots:
    void slotChagedTab(int i);
    void slotDateCanged();
    void slotActAddPerson();
    void slotExit();
    //benya
    void slotDelPerson();
    void slotEditPerson();
    void slotAboutQt();
    void slotAboutT13();
    void slotSave();
    void slotSaveAs();
    void slotOpen();
    void slotIsChanged();

    // print
    void slotPrint();
    void slotExport();
    void slotShowSettings();
    void slotNew();

    // Recently Files
    void slotClearRecent();
    void slotOpenRecentFile();

};

#endif // MAINWINDOW_H
